package truly;

/**
 * @Author Big_white
 * @Date 2021/11/21
 */
public class Client {
    public static void main(String[] args) {
        GameRole gameRole = new GameRole();
        gameRole.setVit(100);
        gameRole.setDef(100);
        System.out.println("和boss大战前的状态");
        gameRole.display();
        //把前线状态保存caretaker
        Caretaker caretaker=new Caretaker();
        caretaker.setMemento(gameRole.createMemento());
        System.out.println("和boss大战----");
        gameRole.setDef(30);
        gameRole.setVit(30);
        gameRole.display();
        System.out.println("大战后，使用备忘录对象恢复到大战前");
        gameRole.recoverGameRoleFromMemento(caretaker.getMemento());
        System.out.println("恢复后的状态----");
        gameRole.display();
    }
}
